package fun.liuyu2783.dtc.goods.controller;


import fun.liuyu2783.dtc.common.Response;
import fun.liuyu2783.dtc.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liuyu2783
 * @since 2021-11-23
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @RequestMapping("/stock/{tradeId}")
    public Response createOrder(@PathVariable("tradeId") String tradeId){
        return goodsService.stock(tradeId, 1);
    }


    @RequestMapping("/page")
    public Response page(){
        return goodsService.page();
    }
}

